{% extends 'base.html' %}
{% block title %}首页{% endblock %}
{% block content %}

    <div class="page-header">
        <h1>KKlog</h1>
    </div>


    <div class="row">

        <div class="col-sm-8">
        <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="{{ url_for('static',filename='images/header1.jpg') }}" alt="First slide" style="height: 15rem;">
        <div class="carousel-caption d-none d-md-block">
    <h5>What is the meaning of travel</h5>
    <p>Travel can cultivate people's endurance.</p>
  </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="{{ url_for('static',filename='images/header2.jpg') }}" alt="Second slide" style="height: 15rem;">
        <div class="carousel-caption d-none d-md-block">
    <h5>Tourism, is to relax.</h5>
    <p>A good companion can shorten the journey time.</p>
  </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="{{ url_for('static',filename='images/header3.jpg') }}" alt="Third slide" style="height: 15rem;">
        <div class="carousel-caption d-none d-md-block">
    <h5>The world is a book</h5>
    <p>Travel makes a wise man more wisdom, a fool more.</p>
  </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
            <br>

{% if posts %}
    {% for post in posts %}
        <h3 class="text-primary"><a href="{{ url_for('.show_post',slug=post.title) }}">{{ post.title }}</a></h3>
        <p>
            {{ post.body|striptags|truncate(120) }}
            <small><a href="{{ url_for('.show_post',slug=post.title) }}">阅读更多</a></small>
        </p>
        <small>
            评论: <a href="{{ url_for('.show_post',slug=post.title) }}#comments">{{ post.comments|length }}</a>&nbsp;&nbsp;
            分类: <a href="{{ url_for('.show_category',category_id=post.category.id) }}">{{ post.category.name }}</a>
            <span class="float-right">{{ moment(post.timestamp).format('LL') }}</span>
        </small>

        {% if not loop.last %}
        <hr>
        {% endif %}

    {% endfor %}

    {% else %}
    <div class="tip">
        <h5>还没有文章</h5>
        {% if current_user.is_authenticated %}
            <a href="{{ url_for('admin.new_post') }}">现在就发布文章</a>

            {% endif %}
    </div>
        {% endif %}
    </div>

            <div class="col-sm-4 sidebar">
            {% include "_sidebar.html" %}


        </div>


    </div>
    <br>
    <center>
    <div class="pagination" align="center">
{% from 'macros.html' import pager %}
    {{ pager(pagination) }}
        </div>
        </center>

{##}
{#{% from 'bootstrap/pagination.html' import render_pagination %}#}
{#    <div class="page-footer">{{ render_pagination(pagination) }}</div>#}



{% endblock %}